<template>
	<view>
		<u-card padding="20" box-shadow="10rpx 10rpx 10rpx #c8c9cc" v-if="orders">
			<view slot="head"
				style="padding: 10rpx;display: flex;justify-content: space-between;font-weight: bold;padding-left: 0;">
				<view style="display: flex;">
					<view style="max-width: 150rpx;white-space: nowrap;">
						<u-tag bg-color="#5D77A4" color="#fff" border-color="#4C6C9E" v-if="orders.state_id<3" text="出车" type="info" />
						<u-tag bg-color="#5D77A4" color="#fff" border-color="#4C6C9E" v-if="orders.state_id==3" text="收车" type="info" />
						<u-tag bg-color="#5D77A4" color="#fff" border-color="#4C6C9E" v-if="orders.state_id>3" text="已收车"  type="info" />
					</view>
					<view style="margin-left: 10rpx;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">{{orders.employe_name}}</view>
					<view style="margin: 0 10rpx;color: #c8c9cc;">|</view>
					
					<view v-if="orders.state_id<3" style="white-space: nowrap;">{{$u.timeFormat(orders.take_date, 'mm月dd日hh:MM')}}</view>
					<view v-else style="white-space: nowrap;">{{$u.timeFormat(orders.return_date, 'mm月dd日hh:MM')}}</view>
				</view>
				<!-- <view v-if="orders.state_id<3" style="color: #ff9900;white-space: nowrap;">待服务</view>
				<view v-if="orders.state_id==3" style="color: #19be6b;white-space: nowrap;">进行中</view> -->
			</view>
			<view slot="body">
				<view style="margin-bottom: 20rpx;display: flex;">
					<u-tag text="起" mode="dark" bg-color="#c8c9cc" type="info" />
					<text style="margin-left: 10rpx;">{{orders.take_location}}</text>
				</view>
				<view style="display: flex;align-items: center;">
					<u-tag text="终" mode="dark" type="primary" />
					<text
						style="margin-left: 10rpx;color: #000;font-weight: bold;">{{orders.return_location}}</text>
				</view>
				<view style="background-color: #F8F8F8;margin-top: 20rpx;padding: 10rpx;border-radius: 10rpx;"
					@click="toInfo(orders.orders_id)">
					<view style="display:flex;align-items: center;color: #000;font-weight: bold;">
						<text style="margin:0 10rpx;font-weight: normal;">{{orders.car_type_name}}</text>


					</view>
					<view style="display:flex;align-items: center;margin:10rpx 0;color: #000;font-weight: bold;justify-content: space-between;">
						<view> 
							<!-- <u-icon name="account" size="28"></u-icon> -->
							<text style="margin:0 10rpx;" v-if="orders.custom_name">{{orders.custom_name}}</text>
							<text style="margin:0 10rpx;" v-else>{{orders.appt_name}}</text>
							
							<text style="font-weight: bold;" v-if="orders.custom_type==2">单位</text>
							<text style="font-weight: bold;" v-else>个人</text>
						</view>
						<view><u-tag :text="orders.car_num" style="width: 160rpx;" type="primary" /></view>

					</view>
					<view>
						<text v-if="orders.orders_source_id==1">后台录入</text>
						<text v-if="orders.orders_source_id==2">系统商城</text>
						<text v-if="orders.orders_source_id==3">哈罗</text>
						<text v-if="orders.orders_source_id==4">飞猪</text>
						<text v-if="orders.orders_source_id==5">携程</text>
						<text v-if="orders.orders_source_id==6">滴滴打车</text>
						<text v-if="orders.orders_source_id==7">第三方推荐</text>

						<text style="margin: 0 10rpx;color: #c8c9cc;">|</text>
						<text>订单号：{{orders.orders_num}}</text>
						<u-icon name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
		</u-card>
	</view>
</template>

<script>
	export default {
		name: "OrderCard",
		props: {
			orders: {
				type: Object
			}
		},
		data() {
			return {

			};
		},
		mounted() {
			var that=this;
			
		},
		methods: {
			getOrdersInfo(orders_id){
				var that=this;
				that.$http.post('/orders/queryById?orders_id='+orders_id, {}, (res) => {
					if (res.data.success) {
						that.orders=res.data.result;
					} else {
						that.refs.myModal.show('请求失败', res.data.result.message);
					}
				});
			},
			toInfo(orders_id) {
				uni.navigateTo({
					url: '/pages/ordersInfo/ordersInfo?orders_id=' + this.orders.orders_id
				})
			}
		}
	}
</script>

<style>

</style>